//
//  CAImageView.m
//  LNH
//
//  Created by twentylx on 2018/2/24.
//  Copyright © 2018年 twentylx. All rights reserved.
//

#import "CAImageView.h"

@implementation CAImageView

/**
 为视图绑定 viewModel
 
 @param viewModel 要绑定的ViewModel
 @param params 额外参数
 */
- (void)bindViewModel:(id <LMViewProtocol>)viewModel withParams:(NSDictionary *)params {
    
}

/**
 初始化额外数据
 */
- (void)lm_initializeForView {
    self.backgroundColor = [UIColor whiteColor];
}

/**
 初始化视图
 */
- (void)lm_createViewForView {
    [self setNeedsUpdateConstraints];
    
    [self addSubview:self.returnImageView];
    [self.returnImageView addSubview:self.returnTitleLabel];
    [self.returnImageView addSubview:self.return1ImageView];
    [self.returnImageView addSubview:self.return2ImageView];
    [self.returnImageView addSubview:self.return3ImageView];
    [self.returnImageView addSubview:self.return4ImageView];
}

#pragma mark layout
- (void)updateConstraints {
    [super updateConstraints];
    [_returnImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.and.right.equalTo(self);
        make.top.equalTo(self).offset(10);
        make.height.mas_equalTo(130);
    }];
    
    [_returnTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.returnImageView).offset(20);
        make.top.equalTo(self.returnImageView).offset(10);
    }];
    
    [_return1ImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.returnImageView).offset(20);
        make.top.equalTo(self.returnTitleLabel.mas_bottom).offset(10);
        make.size.mas_equalTo(CGSizeMake(80, 80));
    }];
    
    [_return2ImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.return1ImageView.mas_right).offset(30);
        make.top.equalTo(self.returnTitleLabel.mas_bottom).offset(10);
        make.size.mas_equalTo(CGSizeMake(80, 80));
    }];
    
    [_return3ImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.return2ImageView.mas_right).offset(30);
        make.top.equalTo(self.returnTitleLabel.mas_bottom).offset(10);
        make.size.mas_equalTo(CGSizeMake(80, 80));
    }];
}

#pragma mark get & set
- (UIView *)returnImageView {
    if (!_returnImageView) {
        _returnImageView = [UIView new];
        _returnImageView.backgroundColor = [UIColor whiteColor];
    }
    return _returnImageView;
}

- (UILabel *)returnTitleLabel {
    if (!_returnTitleLabel) {
        _returnTitleLabel = [UILabel new];
        _returnTitleLabel.text = @"上传凭证";
        _returnTitleLabel.font = [UIFont systemFontOfSize:16];
        _returnTitleLabel.textColor = RGBCOLOR(35, 24, 21);
    }
    return _returnTitleLabel;
}

- (UIImageView *)return1ImageView {
    if (!_return1ImageView) {
        _return1ImageView = [UIImageView new];
        _return1ImageView.image = LMImageNamed(@"return_upload");
//        _return1ImageView.layer.borderWidth = 1;
    }
    return _return1ImageView;
}

- (UIImageView *)return2ImageView {
    if (!_return2ImageView) {
        _return2ImageView = [UIImageView new];
//        _return2ImageView.layer.borderWidth = 1;
    }
    return _return2ImageView;
}

- (UIImageView *)return3ImageView {
    if (!_return3ImageView) {
        _return3ImageView = [UIImageView new];
//        _return2ImageView.layer.borderWidth = 1;
    }
    return _return3ImageView;
}

@end
